﻿#region Using Statements
using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework;
using JigLibX.Collision;
using JigLibX.Physics;
using JigLibX.Geometry;
using JigLibX.Math;
using Microsoft.Xna.Framework.Graphics;
#endregion

namespace ImportModelFromRhino.PhysicObjects
{
    public class gattoObject : PhysicObject
    {
        public gattoObject(Game game,Model model, Matrix orientation, Vector3 position, Vector3 scale, Viewport[] viewports) : base(game,model, viewports)
        {
            body = new Body();
            collision = new CollisionSkin(body);

            collision.AddPrimitive(new Sphere(new Vector3(-2.65704f, 0.08229f, 1.839895f), 3.9f), new MaterialProperties(0f, 0.8f, 0.7f));
            collision.AddPrimitive(new Sphere(new Vector3(-2.6550405f, -2.00603f, 8.083145f), 2.5960395f), new MaterialProperties(0f, 0.8f, 0.7f));
            collision.AddPrimitive(new Box(new Vector3(-5.688f, -4.139f, -2.1f), Matrix.Identity, new Vector3(5.688f, 5.76409f, 0.83107f)), new MaterialProperties(0f, 0.8f, 0.7f));
            body.CollisionSkin = this.collision;
            Vector3 com = SetMass(1.0f);
            body.MoveTo(position, orientation);
            //collision.ApplyLocalTransform(new Transform(-com, Matrix.Identity));
            body.EnableBody();
            this.scale = scale;
        }

        public override void ApplyEffects(BasicEffect effect)
        {
            Game.GraphicsDevice.DepthStencilState = DepthStencilState.Default;
            Game.GraphicsDevice.RasterizerState = RasterizerState.CullNone;
            Game.GraphicsDevice.BlendState = BlendState.Opaque;
            //effect.DiffuseColor = color;
        }
    }
}
